﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace 学生成绩查询及选课系统.student
{
    public partial class myGrade : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }
        }

        public void bind()
        {
            string sql = "select grade.stuno as '学号',stuname as '学生姓名',course.cname as '课程名',cproperties as '课程性质',score as '分数' from grade" +
            " join student on grade.stuno=student.stuno " +
            " join course on grade.cno=course.cno " +
            " group by grade.stuno,stuname,course.cname,course.cproperties,grade.score,course.cstate,grade.status having course.cstate=1 and grade.status=1 and  grade.stuno=" + Session["user"].ToString();
            DataTable dt = DBAccess.GetTable(sql);
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
    }
}